import request from "./request";

export function login(data) {
  return request.post("/user/login", data);
}

export function logout() {
  return request.delete("/user/logout");
}

// 商品管理模块接口
export function selectGoodsPage(data) {
  return request.post("/goods/selectGoodsPage", data);
}
export function selectGoodsById(data) {
  return request.get("/goods/selectById", {
    params: data,
  });
}

export function createGoods(data) {
  return request.post("/goods/create", data);
}
export function updateGoods(data) {
  return request.put("/goods/update", data);
}
export function addLabel(data) {
  return request.get("/goods/addLabel", {
    params: data,
  });
}
export function unBindLabel(data) {
  return request.delete("/goods/deleteLabel", {
    params: data,
  });
}
export function deleteGoods(data) {
  return request.delete("/goods/delete", {
    params: data,
  });
}
export function setIndexFile(data) {
  return request.get("/goods/setIndexFile", {
    params: data,
  });
}

// 文件模块接口
export function selectFilesByGoodsId(data) {
  return request.get("/file/selectFilesByGoodsId", {
    params: data,
  });
}
export function uploadFile(data) {
  return request.post("/file/upload", data,{
    headers: {
      'Content-Type':'multipart/form-data',
    }
  });
}
export function deleteFile(data) {
  return request.delete("/file/delete", {
    params: data,
  });
}

// 标签模块接口
export function selectLabelPage(data) {
  return request.post("/label/selectLabelPage", data);
}
export function selectBindLabelPage(data) {
  return request.post("/label/selectBindByPage", data);
}
export function selectUnBindLabelPage(data) {
  return request.post("/label/selectUnBindByPage", data);
}
export function createLabel(data) {
  return request.post("/label/create", data);
}
export function updateLabel(data) {
  return request.put("/label/update", data);
}
export function deleteLabel(data) {
  return request.delete("/label/delete", {
    params: data,
  });
}

// 地点模块接口
export function selectLocationPage(data) {
  return request.post("/location/selectLocationPage", data);
}
export function selectSubLocations(data) {
  return request.get("/location/selectSubLocations", {
    params: data,
  });
}
export function createLocation(data) {
  return request.post("/location/create", data);
}
export function updateLocation(data) {
  return request.put("/location/update", data);
}
export function deleteLocation(data) {
  return request.delete("/location/delete", {
    params: data,
  });
}

// 用户模块接口
export function selectUserPage(data) {
  return request.post("/user/selectUserPage", data);
}
export function createUser(data) {
  return request.post("/user/create", data);
}
export function updateUser(data) {
  return request.put("/user/update", data);
}
export function deleteUser(data) {
  return request.delete("/user/delete", {
    params: data,
  });
}

// 价格模块接口
export function selectPricePage(data) {
  return request.post("/price/selectPricePage", data);
}
export function createPrice(data) {
  return request.post("/price/create", data);
}
export function updatePrice(data) {
  return request.put("/price/update", data);
}
export function deletePrice(data) {
  return request.delete("/price/delete", {
    params: data,
  });
}
